package com.bsoft.server.service;


import com.bsoft.core.api.OrgService;
import com.bsoft.core.bean.OrgInfo;
import com.bsoft.server.annotation.RpcService;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RpcService(interfaceType = OrgService.class, version = "1.0")
public class OrgServiceImpl implements OrgService {

    @Override
    public OrgInfo getById(int orgId) {
        OrgInfo orgInfo = new OrgInfo();
        orgInfo.setOrgId(orgId);
        orgInfo.setOrgCode("N001");
        orgInfo.setOrgName("浙医二院");
        orgInfo.setCreateTime(new Date());
        orgInfo.setLatitude(120.218035);
        orgInfo.setLongitude(30.213919);
        return orgInfo;
    }

    @Override
    public String getOrgNameById(int orgId) {
        return "浙医二院";
    }

    @Override
    public List<OrgInfo> queryOrg(OrgInfo orgInfo) {
        return new ArrayList<OrgInfo>() {
            {
                OrgInfo orgInfo = new OrgInfo();
                orgInfo.setOrgId(1);
                orgInfo.setOrgCode("N001");
                orgInfo.setOrgName("浙医二院-庆春院区");
                orgInfo.setCreateTime(new Date());
                orgInfo.setLatitude(120.218035);
                orgInfo.setLongitude(30.213919);
                add(orgInfo);

                OrgInfo orgInfo1 = new OrgInfo();
                orgInfo1.setOrgId(2);
                orgInfo1.setOrgCode("N002");
                orgInfo1.setOrgName("浙医二院-滨江院区");
                orgInfo1.setCreateTime(new Date());
                orgInfo1.setLatitude(120.218035);
                orgInfo1.setLongitude(30.213919);
                add(orgInfo1);
            }
        };
    }
}
